#ifndef __TDS_PROTOCOL_H__
#define __TDS_PROTOCOL_H__

#include "base_protocol.h"


// TDS协议相关内容
#define TDS_SMP_FLG_SYN  1
#define TDS_SMP_FLG_ACK  2
#define TDS_SMP_FLG_FIN  4
#define TDS_SMP_FLG_DATA 8

#define TDS_SQL_BATCH   0x01
#define TDS_LOGIN5      0x02
#define TDS_RPC         0x03
#define TDS_RESPONSE    0x04
#define TDS_SIGNAL      0x06
#define TDS_BULK_DATA   0x07
#define TDS_TRANSACTION 0x0e
#define TDS_QUERY5      0x0f 
#define TDS_LOGIN7      0x10
#define TDS_PRE_LOGIN   0x12
#define TDS_SMP         0x53


namespace secsmart_protocol
{
    class TdsProtocol: public BaseProtocol{
    public:
        TdsProtocol(){
            databaseName = DBNAME_SQLSERVER;
        }
        virtual DETECT_RESULT parse(secsmart_session::session_sptr session, const uint8_t *buf, size_t size, bool is_forward);

        std::string extendInfo();
    private:
        DETECT_RESULT parseSmp(secsmart_session::session_sptr session, const uint8_t *buf, size_t size, bool is_forward);
        bool isTdsType(uint8_t type);
        
    };
}

#endif